package com.fy.market.strategy.model.enums;

import lombok.Getter;

/**
 * 抽奖规则类型枚举
 * @author fwq
 * @date 2025-09-03
 * @desc 抽奖规则类型枚举
 */
@Getter
public enum RuleTypeEnum {

    STRATEGY_RULE(1, "策略规则"),
    AWARD_RULE(2, "奖品规则");

    private final Integer code;
    private final String info;

    RuleTypeEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public static RuleTypeEnum getByCode(Integer code) {
        for (RuleTypeEnum ruleTypeEnum : RuleTypeEnum.values()) {
            if (ruleTypeEnum.getCode().equals(code)) {
                return ruleTypeEnum;
            }
        }
        return null;
    }

    public static RuleTypeEnum getByInfo(String info) {
        for (RuleTypeEnum ruleTypeEnum : RuleTypeEnum.values()) {
            if (ruleTypeEnum.getInfo().equals(info)) {
                return ruleTypeEnum;
            }
        }
        return null;
    }
}